﻿using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;

namespace Cheems.HMI.Models
{
    /// <summary>
    /// HMI基础配置
    /// </summary>
    public class HMIConfig
    {
        static HMIConfig()
        {
            Default = new HMIConfig()
            {
                AppName = "Cheems APP",
                WindowBackColor = Color.FromArgb(0xFF, 0x42, 0x86, 0xF5),
                WindowTitleForeground = Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF),
                WindowForeground = Color.FromArgb(0xFF, 0x66, 0x66, 0x66),
                AppBackColor = Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF),
                WindowFontSize = 25,
                WindowCornerRadius = new CornerRadius(10),
                MainWindowSize = new WindowSize()
                {
                    Width = 1280,
                    Height = 720,
                },
                ChildWindowSize = new WindowSize()
                {
                    Width = 1024,
                    Height = 600,
                },
                InputCardWindowSize = new WindowSize()
                {
                    Width = 320,
                    Height = 450,
                }
            };
        }

        /// <summary>
        /// 软件名称
        /// </summary>
        public string AppName { get; set; }

        /// <summary>
        /// 软件窗体颜色
        /// </summary>
        public Color WindowBackColor { get; set; }

        /// <summary>
        /// 软件窗体字体颜色
        /// </summary>
        public Color WindowTitleForeground { get; set; }

        /// <summary>
        /// 软件主体背景色
        /// </summary>
        public Color AppBackColor { get; set; }

        /// <summary>
        /// 软件窗体字体颜色
        /// </summary>
        public Color WindowForeground { get; set; }

        /// <summary>
        /// 软件窗体字体大小
        /// </summary>
        public double WindowFontSize { get; set; }

        /// <summary>
        /// 软件窗体圆角
        /// </summary>
        public CornerRadius WindowCornerRadius { get; set; }

        /// <summary>
        /// 主窗口分辨率
        /// </summary>
        public WindowSize MainWindowSize { get; set; }

        /// <summary>
        /// 子窗口分辨率
        /// </summary>
        public WindowSize ChildWindowSize { get; set; }

        /// <summary>
        /// 输入卡片窗口分辨率
        /// </summary>
        public WindowSize InputCardWindowSize { get; set; }

        /// <summary>
        /// 默认值
        /// </summary>
        public static HMIConfig? Default { get; set; }
    }

    public class WindowSize : BindableBase
    {
        private double _width;
        /// <summary>
        /// 窗口宽度
        /// </summary>
        public double Width
        {
            get { return _width; }
            set { SetProperty(ref _width, value); }
        }
        private double _height;

        /// <summary>
        /// 窗口高度
        /// </summary>
        public double Height
        {
            get { return _height; }
            set { SetProperty(ref _height, value); }
        }
    }
}
